package com.bit.mybatis.service;

import com.bit.mybatis.mapper.UserInfoMapper;
import com.bit.mybatis.modle.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserInfoService {
    @Autowired
    private UserInfoMapper userInfoMapper;
    public List<UserInfo> setAllUser() {
         return userInfoMapper.selectAll();
    }
    public UserInfo getAllUserById(Integer id) {
        return userInfoMapper.userAllById(id);
    }

    public UserInfo queryMysqlByUserNameAndPassword(String userName, String password) {
        //由于获取到的mysql是一个表，所以需要使用到一个集合进相关的接收操作；
        List<UserInfo> userInfos=userInfoMapper.selectUserNameAndPassword4(userName,password);
        if(userInfos!=null&&userInfos.size()>=1){
            return userInfos.get(0);
        }
        return null;
    }
}
